import * as actionTypes from '../actions/ActionTypes';

import {handleActions} from 'redux-actions';

const defData = {//职位详情
    xzPostion: {},
    isloading: true//是否读取ing1
}

export const SelisSendReducer = handleActions({
    [actionTypes.SEL_POSTIONSEND]: {
        next(state, action) {
            return {ret: true, data: action.payload};
        },
        throw(state, action) {
            return {ret: false, statusText: "报错", data: defData};
        }
    }
}, {ret: true, statusText: '默认', data: defData});

const defData1 = {//职位详情
    msgSend: {},
    isloading: true//是否读取ing1
}

export const SendPostionReducer = handleActions({
    [actionTypes.SEND_POSTION]: {
        next(state, action) {
            return {ret: true, data: action.payload};
        },
        throw(state, action) {
            return {ret: false, statusText: "报错", data: defData1};
        }
    }
}, {ret: true, statusText: '默认', data: defData1});

//20171220-王继顺
//职位-暂不推荐
const defData2 = {
    sendId: 0,
    msg: '',
};
export const PostionSendDelayReducer = handleActions({
    [actionTypes.POSTION_SEND_DELAY]: {
        next(state, action) {
            return {ret: true, data: action.payload};
        },
        throw() {
            return {ret: false, statusText: "报错", data: defData2};
        }
    }
}, {ret: true, statusText: '默认', data: defData2});

//20171221-王继顺
//职位-预约面试
const defData3 = {
    companyName: '',
    location: '',
    time: 0,
    msg: '',
};
export const PostionSendAcceptReducer = handleActions({
    [actionTypes.POSTION_SEND_ACCEPT]: {
        next(state, action) {
            return {ret: true, data: action.payload};
        }, throw() {
            return {ret: false, statusText: "报错", data: defData3};
        }
    }
}, {ret: true, statusText: '默认', data: defData3});